package com.tedu._04mybatis.mapper;

import com.tedu._04mybatis.pojo.Article;
import com.tedu._04mybatis.pojo.ArticleV01;
import com.tedu._04mybatis.pojo.ArticleV02;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ArticleMapper {
    //@Insert("INSERT INTO article(content,created,user_id) VALUES (#{content},#{created},#{userId})")
    int insertArticle(Article article);

    //@Delete("DELETE FROM article WHERE id=#{id}")
    int deleteArticle(Integer id);
    //@Update("UPDATE article SET content=#{content},created=#{created},user_id=#{userId} WHERE id=#{id}")
    int updateArticle(Article article);
    //@Select("SELECT id,content,created,user_id userId FROM article WHERE id=#{id}")
    Article selectArticleById(Integer id);

//    @Select("SELECT id,content,created,user_id userId " +
//            "FROM article")
    List<Article> selectAllArticle();

//    @Select("SELECT content,created " +
//            "FROM article " +
//            "WHERE id=#{id}")
    ArticleV01 selectArticleVO1ById(Integer id);

//    @Select("SELECT content,created,user_id userId " +
//            "FROM article")
    List<ArticleV02> selectAllArticleV02();
    int dynamicUpdateArticle( Article article);
    int dynamicDeleteArticle( Integer[] ids);

}
